package cn.edu.lsnu.mbti.controller;

import cn.edu.lsnu.mbti.common.R;
import cn.edu.lsnu.mbti.entity.Category;
import cn.edu.lsnu.mbti.service.CategoryService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("category")
public class CategoryController {


    @Resource
    private CategoryService categoryService;

    /**
     * vue后台管理查询分类集合
     * 因为逻辑简单，直接在该层查询
     * @return
     */
    @GetMapping("list")
    public R<List<Category>> list(){
        return R.success(categoryService.list());
    }
}
